﻿using MediatR;
using T.Basic.API.Appliction.Command.CargoOwnerCommand;
using T.Basic.API.Appliction.Command.LineCommand;
using T.Basic.Repository.BasicInterface;

namespace T.Basic.API.Appliction.CommandHandlers.CargoOwnerHanders
{
    /// <summary>
    /// 单删货主信息
    /// </summary>
    public class CargoOwnerDeleteCommandHandeler : IRequestHandler<CargoOwnerDeleteCommand, int>
    {
        private readonly ICargoOwnerRepository _CargoOwnerrepository;
        public CargoOwnerDeleteCommandHandeler(ICargoOwnerRepository cargoOwnerrepository)
        {
            _CargoOwnerrepository = cargoOwnerrepository;
        }
        public async Task<int> Handle(CargoOwnerDeleteCommand request, CancellationToken cancellationToken)
        {
            var sss = await _CargoOwnerrepository.GetModelsAsync(request.CargoOwnerId);
            sss.IsDeleted = true;
           
            return await _CargoOwnerrepository.UpdateAsync(sss);
        }
    }
}
